<!DOCTYPE HTML>
<html class="butler">
<head>
    <title>科寓共享家</title>
    <% include common/meta.ejs %>
    <% include common/public.ejs %>
</head>
<body>
<!--<div class="weui-pull-to-refresh-layer">
    <div class="pull-to-refresh-arrow"></div> &lt;!&ndash; 上下拉动的时候显示的箭头 &ndash;&gt;
    <div class="pull-to-refresh-preloader"></div> &lt;!&ndash; 正在刷新的菊花 &ndash;&gt;
    <div class="down">下拉刷新</div>&lt;!&ndash; 下拉过程显示的文案 &ndash;&gt;
    <div class="up">释放刷新</div>&lt;!&ndash; 下拉超过50px显示的文案 &ndash;&gt;
    <div class="refresh">正在刷新...</div>&lt;!&ndash; 正在刷新时显示的文案 &ndash;&gt;
</div>-->
<div class="weui-row weui-no-gutter customerTitle ">
    <div style="height: 50px;width: 20%">
        <a href="butlerIndex?openId=<%data.openId%>" style="color: #FFFFFF"><img src="<%= global.config.publicPath %>/page/images/back.png" ></a>
            <span > <a href="butlerIndex?openId=<%data.openId%>" style="color: #FFFFFF">返回</a></span>
    </div>
    <div  style="height: 50px;width: 60%">
        会员详情
    </div>
    <div  style="height: 50px;width: 20%">

    </div>
</div>
<div class="weui_search_bar" id="search_bar">
    <form class="weui_search_outer seachForm">
        <div class="weui_search_inner">
            <i class="weui_icon_search"></i>
            <input type="search" name="name_like" class="weui_search_input" id="searcht" placeholder="请输入用户名"/>
        </div>
        <label for="search_input" class="weui_search_text" id="search_text">
            <i class="weui_icon_search"></i>
            <span>搜索</span>
        </label>
    </form>
    <a href="javascript:" class="weui_search_cancel" id="search_cancel">取消</a>
</div>
<div id="doing" style="background-color: #FFFFFF"></div>
<div class="weui-infinite-scroll">
    <div class="infinite-preloader"></div>
    正在加载...
</div>

<% include common/footer.ejs %>
<script>
    let loadFlag = false;
    let pageNumber = 0;
    let statusData = {
        properties: {}
    };
    function loadingData() {
        console.log(loadFlag);
        statusData.properties.pageSize = 7;
        statusData.properties.pageNumber = 0;
        console.log(statusData);
        if (!loadFlag) {
            loadFlag = true;
            Dolphin.ajax({
                url: CTX + '/api/8f7def63cc5845468b2c65a69abb0664',
                type: 'post',
                data: Dolphin.json2string(statusData),
                forceUrl: 'true',
                onSuccess: function (data) {
                    pageNumber++;
                    loadFlag = false;
                    let list = data.rows;
                    let contractId, con = '', con2 = '';

                    for (let i = 0; i < list.length; i++) {
                        con = con + `<div class="info">
                            <div class="circles"></div>
                            <div class="names2">
                            <p>${list[i].name }</p>
                            <p style="font-size: 0.9em;color: #999999;font-weight: 400">${list[i].phone}</p>
                            </div>
                            <div style="position: relative;left: -5%">
                            <a href="userEdit?id=${list[i].id}">
                                <img src="<%= global.config.publicPath %>/page/images/inter.png" >
                            </a>
                        </div>
                        </div>`

                    }
                    $('#doing').html(con);
                }
            })
        }
    };
    function reloadingData() {
        console.log(loadFlag);
        statusData.properties.pageSize = 7;
        statusData.properties.pageNumber = pageNumber;
        console.log(statusData);
        if (!loadFlag) {
            loadFlag = true;
            Dolphin.ajax({
                url: CTX + '/api/8f7def63cc5845468b2c65a69abb0664',
                type: 'post',
                data: Dolphin.json2string(statusData),
                forceUrl: 'true',
                onSuccess: function (data) {
                    pageNumber++;
                    loadFlag = false;
                    let list = data.rows;
                    let contractId, con = '', con2 = '';

                    for (let i = 0; i < list.length; i++) {
                        con = con + `<div class="info">
                            <div class="circles"></div>
                            <div class="names2">
                            <p>${list[i].name }</p>
                            <p style="font-size: 0.9em;color: #999999;font-weight: 400">${list[i].phone}</p>
                            </div>
                            <div style="position: relative;left: -5%">
                            <a href="userEdit?id=${list[i].id}">
                                <img src="<%= global.config.publicPath %>/page/images/inter.png" >
                            </a>
                        </div>
                        </div>`
                    }
                    $('#doing').append(con);
                }
            })
        }
    };
    //搜索框
    $('#searcht').blur(function () {
        let data = Dolphin.form.getValue('.seachForm');
        let sendDatas={
            properties:{
                name_like:data.name_like
            }
        };
        Dolphin.ajax({
            url: CTX + '/api/8f7def63cc5845468b2c65a69abb0664',
            type: 'post',
            data: Dolphin.json2string(sendDatas),
            forceUrl: 'true',
            onSuccess: function (data) {
                let getOne;
                getOne = `<div class="info">
                            <div class="circles"></div>
                            <div class="names2">
                            <p>${data.rows[0].name }</p>
                            <p style="font-size: 0.9em;color: #999999;font-weight: 400">${data.rows[0].phone}</p>
                            </div>
                            <div style="position: relative;left: -5%">
                            <a href="userEdit?id=${data.rows[0].id}">
                                <img src="<%= global.config.publicPath %>/page/images/inter.png" >
                            </a>
                        </div>
                        </div>`
                $('#doing').html(getOne);
            }
        });
    });
    $(document).ready(
        function () {
            loadingData();
        }
    );
    $(document.body).pullToRefresh();

    $(document.body).on("pull-to-refresh", function () {
        //do something
        loadingData();
        $(document.body).infinite(50);
    });

    $('.weui-infinite-scroll').css('display', 'none');

    $(document.body).infinite(20);

    var loading = false;  //状态标记
    $(document.body).infinite().on("infinite", function () {
        $('.weui-infinite-scroll').css('display', 'block');
        if (loading) return;
        loading = true;
        setTimeout(function () {
            if (!loadFlag) {
                reloadingData();
            }
            loading = false;

        }, 1500);   //模拟延迟
    });

    $("#method").select({
        title: "认证状态",
        items: [
            {
                title: "未验证",
                value: "0",
            },
            {
                title: "审核中",
                value: "1",
            },
            {
                title: "通过验证",
                value: "2",
            }
        ]
    });


</script>

</body>
</html>